
       org $800

main   move.l  #1000,a7


       move.l  #data,a0
       jsr   evenp
       nop



;  address of data is in a0
; compute and insert even parity bit
; into bit 7 of data

evenp  movem.l  d0-d3,-(a7)
       clr.b d0  ; logic 1 counter
       move.w #6,d1   ; loop counter
       move.b (a0),d2
       move.b d2,d3
shift  lsr.b #1,d2
       bcc loop
       add.b #1,d0
loop   dbra d1,shift
       lsr.b #1,d0
       bcc even
       or.b #$80,d3
       bra copy
even   and.b #$7f,d3
copy   move.b d3,(a0)
       movem.l  (a7)+,d0-d3
       rts


          org $b00

data     ds.b 1